package bdd;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse;

import data.Login;

/**
 * Servlet implementation class VerifBd
 */
public class VerifBd extends HttpServlet {
    private static final long serialVersionUID = 8268497187578852991L;

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request,
	    HttpServletResponse response) throws ServletException, IOException {

	response.setContentType("text/html");
	PrintWriter out = response.getWriter();

	Login login = new Login();
	String user = request.getParameter("user");
	String passwd = request.getParameter("passwd");

	login.set(user, passwd);
	if (login.connect())
	    out.print(true);
	else
	    out.print(false);

	out.close();
    }
}
